package service.IOCInsertType;

import api.IMessageDAO;
import api.IMessageService;
import org.springframework.stereotype.Service;

/**
 * Created by cww
 * Date : 2018/5/10
 * @author asd73
 */
@Service
public class MessageService implements IMessageService {

    private IMessageDAO messageDAO;

    /**
     * 设值注入
     * @param messageDAO
     */
//    public void setMessageDAO(IMessageDAO messageDAO) {
//        this.messageDAO = messageDAO;
//    }

    /**
     * 构造注入，参数名称必须一致
     * @param messageDAO
     */
    public MessageService(IMessageDAO messageDAO){
        this.messageDAO = messageDAO;
    }

    @Override
    public String getMessage(String content) {
        messageDAO.saveMessage(content);
        return "getMessage "+content;
    }
}
